<script>
    function menuHandler(item) {
        switch (item) {
            case 'dosen':
                document.location = 'index.php?page=dosen';
                break;
            case 'mhs':
                document.location = 'index.php?page=siswa';
                break;
            case 'matkul':
                document.location = 'index.php?page=matkul';
                break;
            case 'kuliah':
                document.location = 'index.php?page=kuliah';
                break;
            case 'peserta':
                document.location = 'index.php?page=peserta';
                break;
        }
    }
</script>

<?php
	$admin = isset($_SESSION['admin']) && $_SESSION['admin'] == true;
?>
<div id="menubar">
    <a href="index.php?page=main" class="easyui-linkbutton" data-options="plain:true">Home</a>
	<?php 
		if ($admin) {	
	?>
		<a href="#" class="easyui-menubutton" data-options="menu:'#mm1'">Master Data</a>
		<div id="mm1" style="width:150px;">
			<div onclick="menuHandler('dosen')">Data Dosen</div>
			<div onclick="menuHandler('mhs')">Data Mahasiswa</div>
			<div onclick="menuHandler('matkul')">Data Mata Kuliah</div>
		</div>
	<?php 
		} 
	?>
    <a href="#" class="easyui-menubutton" data-options="menu:'#mm2'">Perkuliahan</a>
    <div id="mm2">
	<?php 
		if ($admin) {	
	?>
        <div onclick="menuHandler('kuliah')">Data Perkuliahan</div>
	<?php 
		} 
	?>
        <div onclick="menuHandler('peserta')">Data Peserta Kuliah</div>
    </div>
    
    <a href="#" class="easyui-menubutton" data-options="menu:'#mm3'">About</a>
    <div id="mm3" class="menu-content" style="background:#f0f0f0;padding:10px;text-align:left">
        <img src="asset/img/e-learning.png" style="width:150px;height:50px">
        <p style="font-size:14px;color:#444;">Web Admin eLearning System</p>
    </div>
</div>